home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / Palettes / Clocks / ClockConstantsAndTypes.h < prev   
Text File  |  1995-06-12  |  2KB  |  65 lines

  1. //----------------------------------------------------------------------------------------------------
  2. //
  3. //    Clock Types and Constants
  4. //
  5. //    Clock relies on the 'tm' struct to record its clock and alarm time values.  
  6. //    Associated defines and macros are based on that struct.
  7. //    (Some members are not currently used.)
  8. //
  9. //          struct tm {
  10. //               int tm_sec;            ( 0-59  seconds )
  11. //               int tm_min;            ( 0-59  minutes )
  12. //               int tm_hour;           ( 0-23  hour ( 0 is midnite) )
  13. //               int tm_mday;       ( 1-31  day of month )
  14. //               int tm_mon;        ( 0-11  month )
  15. //               int tm_year;           ( 0-    year - 1900 )
  16. //               int tm_wday;       ( 0-6   day of week (Sunday = 0) )
  17. //               int tm_yday;       ( 0-365 day of year )                                   (Not Used)
  18. //               int tm_isdst;          ( flag: daylight savings time in effect )     (Not Used)
  19. //               long tm_gmtoff;         ( offset from GMT in seconds )                  (Not Used)
  20. //               char *tm_zone;     ( abbreviation of timezone name )            (Not Used)
  21. //          };
  22. //
  23. //
  24. //    Disclaimer
  25. //
  26. //        You may freely copy, distribute and reuse this software and its
  27. //        associated documentation. I disclaim any warranty of any kind, 
  28. //        expressed or implied, as to its fitness for any particular use.
  29. //
  30. //----------------------------------------------------------------------------------------------------
  31. #import <sys/time.h>    
  32.  
  33.  
  34. #define    SUNDAY            0
  35. #define    MONDAY        1
  36. #define    TUESDAY        2
  37. #define    WEDNESDAY    3
  38. #define    THURSDAY        4
  39. #define    FRIDAY            5
  40. #define    SATURDAY        6
  41.  
  42.  
  43. #define    JANUARY        0
  44. #define    FEBRUARY        1
  45. #define    MARCH            2
  46. #define    APRIL            3
  47. #define    MAY            4
  48. #define    JUNE            5
  49. #define    JULY            6
  50. #define    AUGUST            7
  51. #define    SEPTEMBER        8
  52. #define    OCTOBER        9
  53. #define    NOVEMBER        10
  54. #define    DECEMBER        11
  55.  
  56.  
  57. #define    SECOND(tm)        ((tm)->tm_sec)
  58. #define    MINUTE(tm)        ((tm)->tm_min)
  59. #define    HOUR(tm)        ((tm)->tm_hour)
  60. #define    DAY(tm)            ((tm)->tm_mday)
  61. #define    MONTH(tm)        ((tm)->tm_mon)
  62. #define    YEAR(tm)        ((tm)->tm_year)
  63. #define    WEEKDAY(tm)    ((tm)->tm_wday)
  64.  
  65. #define    SECONDS(tm)    (HOUR(tm) * 3600 + MINUTE(tm) * 60 + SECOND(tm))